﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows" xmlns:ColorPicker="clr-namespace:DeepEarth.BingMapsToolkit.Client.Controls;assembly=DeepEarth.BingMapsToolkit.Client.Controls.ColorPicker" xmlns:GeometryStylePicker="clr-namespace:DeepEarth.BingMapsToolkit.Client.Controls" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" >

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/DeepEarth.BingMapsToolkit.Client.Common;component/Resources/CommonStyles.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <GeometryStylePicker:ThicknessToDisplayValueConverter x:Key="thicknessToDisplayValueConverter"/>
    <GeometryStylePicker:OpacityToDisplayValueConverter x:Key="opacityToDisplayValueConverter"/>
    <GeometryStylePicker:HexColorToBrushValueConverter x:Key="hexColorToBrushValueConverter"/>
   
    <Style TargetType="GeometryStylePicker:GeometryStylePicker">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="GeometryStylePicker:GeometryStylePicker">
                    <StackPanel x:Name="stackPanel" VerticalAlignment="Top" HorizontalAlignment="Left" Orientation="Horizontal" Margin="2,0">

                       
                		<VisualStateManager.VisualStateGroups>
                			<VisualStateGroup x:Name="ColorPickerState">
                				<VisualStateGroup.Transitions>
                					<VisualTransition GeneratedDuration="0:0:0.3"/>
                				</VisualStateGroup.Transitions>
                				<VisualState x:Name="ShowColorPicker">
                					<Storyboard>
                						<DoubleAnimation Duration="0" To="210" Storyboard.TargetProperty="(FrameworkElement.Width)" Storyboard.TargetName="PART_colourPicker" d:IsOptimized="True"/>
                					</Storyboard>
                				</VisualState>
                				<VisualState x:Name="HideColorPicker"/>
                			</VisualStateGroup>
                		</VisualStateManager.VisualStateGroups>

                       
                		<Grid Width="204">
                			<Grid.RowDefinitions>
                				<RowDefinition />
                				<RowDefinition />
                				<RowDefinition />
                				<RowDefinition />
                				<RowDefinition />
                				<RowDefinition />
                				<RowDefinition />
                				<RowDefinition />
                				<RowDefinition />
                				<RowDefinition />
                			</Grid.RowDefinitions>

                			<Grid.ColumnDefinitions>
                				<ColumnDefinition Width="Auto" MinWidth="60"  />
                				<ColumnDefinition Width="*" />
                			</Grid.ColumnDefinitions>
                            
                			<TextBlock Margin="0,2,0,2" Grid.Row="0" HorizontalAlignment="Right" Text="ID" Foreground="#FFFFFFFF" Visibility="Collapsed" />

                			<TextBlock Margin="0,2,0,2" Grid.Row="1" HorizontalAlignment="Right" Text="Show Line" Foreground="#FFFFFFFF" />
                			<CheckBox x:Name="ShowLineValue" Grid.Column="1" Grid.Row="1" Width="35" Margin="3,0,0,0" Height="18" FontSize="9" HorizontalAlignment="Left" IsChecked="{Binding ShowLine, Mode=TwoWay}" Style="{StaticResource CheckBoxStyle}" />

                			<TextBlock Grid.Column="0" Grid.Row="2" Text="Line Color" Foreground="#FFFFFFFF" Margin="0,1,1,1" VerticalAlignment="Center" HorizontalAlignment="Right" />
                			<StackPanel Margin="3,1,0,1" Grid.Column="1" Grid.Row="2" Orientation="Horizontal">
                				<ToggleButton x:Name="PART_lineColor" Foreground="#FFFFFFFF"  Height="21" Style="{StaticResource ToggleButtonStyle}" >
                					<Image HorizontalAlignment="Left" Source="/DeepEarth.BingMapsToolkit.Client.Controls.GeometryStylePicker;component/Images/Color.png"/>
                				</ToggleButton>
                				<Rectangle x:Name="LineColorDisplay" Fill="{Binding LineColour, Converter={StaticResource hexColorToBrushValueConverter}}" RadiusY="8" RadiusX="8" Stroke="#FF000000" Height="18" Margin="3,1,3,1" Width="75"/>
                			</StackPanel>

                			<TextBlock Margin="0,2,0,2" Grid.Row="3" HorizontalAlignment="Right" Text="Line Thickness" Foreground="#FFFFFFFF" />
                			<TextBox x:Name="ThicknessValue" Grid.Column="1" Grid.Row="3"  Width="35" TextAlignment="Right" Margin="3,0,0,0" Height="18" FontSize="9" HorizontalAlignment="Left" Text="{Binding LineWidth, Converter={StaticResource opacityToDisplayValueConverter}, Mode=TwoWay}" Style="{StaticResource TextBoxStyle}"/>
                			<Slider x:Name="LineThickness" Grid.Column="1" Grid.Row="3"  SmallChange="1" LargeChange="4" Maximum="20" Minimum="1" Value="{Binding LineWidth, Mode=TwoWay}"  Margin="38,1,3,1" HorizontalContentAlignment="Left" Style="{StaticResource SliderStyle}"/>

                			<TextBlock Margin="0,2,0,2" Grid.Row="4" HorizontalAlignment="Right" Text="Show Fill" Foreground="#FFFFFFFF" />
                			<CheckBox x:Name="ShowFillValue" Grid.Column="1" Grid.Row="4" Width="35" Margin="3,0,0,0" Height="18" FontSize="9" HorizontalAlignment="Left" IsChecked="{Binding ShowFill, Mode=TwoWay}" Style="{StaticResource CheckBoxStyle}" />

                			<TextBlock Grid.Column="0" Grid.Row="5" Text="Fill Color" Foreground="#FFFFFFFF" Margin="0,1,1,1" VerticalAlignment="Center" HorizontalAlignment="Right" />
                			<StackPanel HorizontalAlignment="Stretch" Margin="3,1,0,1" Width="Auto" Grid.Column="1" Grid.Row="5" Orientation="Horizontal">
                				<ToggleButton x:Name="PART_fillColor" Foreground="#FFFFFFFF"  Height="21" Style="{StaticResource ToggleButtonStyle}">
                					<Image HorizontalAlignment="Left" Source="/DeepEarth.BingMapsToolkit.Client.Controls.GeometryStylePicker;component/Images/Color.png"/>
                				</ToggleButton>
                				<Rectangle x:Name="FillColorDisplay" Fill="{Binding PolyFillColour, Converter={StaticResource hexColorToBrushValueConverter}}" RadiusY="8" RadiusX="8" Margin="3,1,3,1" Width="75" Stroke="#FF000000" Height="18"/>
                			</StackPanel>

                			<TextBlock Margin="0,2,0,2" Grid.Row="6" HorizontalAlignment="Right" Text="Polygon Thickness" Foreground="#FFFFFFFF" TextWrapping="Wrap" />
                			<TextBox x:Name="PolygonThicknessValue" Grid.Column="1" Grid.Row="6"  Width="35" TextAlignment="Right" Margin="3,0,0,0" Height="18" FontSize="9" HorizontalAlignment="Left" Text="{Binding PolygonLineWidth, Converter={StaticResource opacityToDisplayValueConverter}, Mode=TwoWay}" Style="{StaticResource TextBoxStyle}"/>
                			<Slider x:Name="PolygonLineThickness" Grid.Column="1" Grid.Row="6"  SmallChange="1" LargeChange="4" Maximum="20" Minimum="1" Value="{Binding PolygonLineWidth, Mode=TwoWay}"  Margin="38,1,3,1" HorizontalContentAlignment="Left" Style="{StaticResource SliderStyle}"/>

                			<TextBlock Grid.Column="0" Grid.Row="7" Text="Polygon Line Color" Foreground="#FFFFFFFF" Margin="0,1,1,1" VerticalAlignment="Center" HorizontalAlignment="Right" TextWrapping="Wrap" />
                			<StackPanel Margin="3,1,0,1" Grid.Column="1" Grid.Row="7" Orientation="Horizontal">
                				<ToggleButton x:Name="PART_polygonLineColor" Foreground="#FFFFFFFF"  Height="21" Style="{StaticResource ToggleButtonStyle}" >
                					<Image HorizontalAlignment="Left" Source="/DeepEarth.BingMapsToolkit.Client.Controls.GeometryStylePicker;component/Images/Color.png"/>
                				</ToggleButton>
                				<Rectangle x:Name="PolygonLineColorDisplay" Fill="{Binding PolygonLineColour, Converter={StaticResource hexColorToBrushValueConverter}}" RadiusY="8" RadiusX="8" Stroke="#FF000000" Height="18" Margin="3,1,3,1" Width="75"/>
                			</StackPanel>
                            
                			<TextBlock Margin="0,2,0,2" Grid.Row="8" HorizontalAlignment="Right" Text="IconURL" Foreground="#FFFFFFFF" Visibility="Collapsed" />
                			<ListBox x:Name="PART_Icons" Grid.Column="1" Grid.Row="8" Margin="3,0,10,0" FontSize="9" HorizontalAlignment="Stretch" SelectedItem="{Binding IconURL, Mode=TwoWay}"  Style="{StaticResource ListBoxStyle}" Visibility="Collapsed"/>

                			<StackPanel Grid.Column="0" Grid.Row="9" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0,1,0,1">
                				<TextBlock Text="IconScale" Foreground="#FFFFFFFF" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,0,3,0" Visibility="Collapsed" />
                				<TextBlock Text="%" Foreground="#FFFFFFFF" VerticalAlignment="Center" Visibility="Collapsed" />
                			</StackPanel>
                			<TextBox x:Name="IconScaleValue" Grid.Column="1" Grid.Row="9" Width="35" TextAlignment="Right" Height="18" FontSize="9" HorizontalAlignment="Left" Margin="3,0,0,0" Text="{Binding IconScale, Converter={StaticResource thicknessToDisplayValueConverter}, Mode=TwoWay}" Style="{StaticResource TextBoxStyle}" Visibility="Collapsed"/>
                			<Slider x:Name="IconScale" Grid.Column="1" Grid.Row="9" SmallChange="0.1" LargeChange="1" Maximum="5" Minimum="0" Value="{Binding IconScale, Mode=TwoWay}"  Margin="38,1,3,1" HorizontalContentAlignment="Left" Orientation="Horizontal" Style="{StaticResource SliderStyle}" Visibility="Collapsed"/>
                			<StackPanel x:Name="stackPanel1" Orientation="Horizontal" HorizontalAlignment="Right" Grid.Column="1" Grid.Row="9" Margin="0,0,3,0" Height="43" VerticalAlignment="Bottom">
                				<TextBox x:Name="IDValue" TextAlignment="Right" Margin="3,0,10,0" Height="18" Width="100" FontSize="9" HorizontalAlignment="Stretch" Text="{Binding ID, Mode=TwoWay}" Style="{StaticResource TextBoxStyle}" Visibility="Collapsed" />
                				<Button x:Name="PART_CancelButton" Margin="5,5,5,5" ToolTipService.ToolTip="Cancel new style" Style="{StaticResource ButtonStyle}">
                					<Image Source="/DeepEarth.BingMapsToolkit.Client.Controls.GeometryStylePicker;component/Images/Delete.png" Width="20" Stretch="Uniform" HorizontalAlignment="Right" ToolTipService.ToolTip="Cancel"/>
                				</Button>
                				<Button x:Name="PART_SaveButton" Margin="5,5,5,5" ToolTipService.ToolTip="Save new style" Style="{StaticResource ButtonStyle}">
                					<Image Source="/DeepEarth.BingMapsToolkit.Client.Controls.GeometryStylePicker;component/Images/Save.png" Width="20" Stretch="Uniform" HorizontalAlignment="Right" ToolTipService.ToolTip="Save"/>
                				</Button>
                			</StackPanel>
                		</Grid>
                		<ColorPicker:ColorPicker x:Name="PART_colourPicker" Margin="0,3,2,0" VerticalAlignment="Center" Height="Auto" RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Left" Width="0">
                			<ColorPicker:ColorPicker.RenderTransform>
                				<CompositeTransform/>
                			</ColorPicker:ColorPicker.RenderTransform>
                		</ColorPicker:ColorPicker>
                	</StackPanel>
                </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

</ResourceDictionary>
